/* 此处是所有配置方法的接口调用维护 */
/*
    用处：
    在组件内使用 import {方法名} from '@/api/system/config' 进行调用
*/

import request from "@/utils/fetch";

// 定义公共的请求首部关键词
const SYSTEMURL = "";

// 获取 菜单按钮权限维护 左侧 Tree
export function queryButtonPermissionList() {
  return request({
    url: SYSTEMURL + "/menuPermission/lists",
    method: "get"
  });
}

// 点击 菜单按钮权限维护 左侧 Tree 根据点击的NODE 对应的menu_id 获取对应的权限
export function querySysPermissionDefineById(id) {
  return request({
    url: SYSTEMURL + "/querySysPermissionDefineById",
    method: "post",
    data: { id },
  });
}

//  菜单按钮权限维护 新增按钮
export function saveSysPermissionDefine(data) {
  return request({
    url: SYSTEMURL + "/menuPermission/addSiblingMenu",
    method: "post",
    data: data,
  });
}
// 菜单按钮权限维护 修改按钮
export function updateSysPermissionDefine(data) {
  return request({
    url: SYSTEMURL + "/menuPermission/updateMenuPermission",
    method: "post",
    data: data,
  });
}
// 菜单按钮权限维护 删除按钮
export function deleteSysPermissionDefine(id) {
  return request({
    url: SYSTEMURL + "/menuPermission/deleteMenuPermissionById/" + id,
    method: "post"
  });
}

// 菜单权限维护 查询已获取的菜单权限
export function queryPermissionList(data) {
  return request({
    url: SYSTEMURL + "/queryPermissionList",
    method: "post",
    data: data,
  });
}

// 菜单权限维护 查询左侧用户
export function queryAllUserList(data) {
  return request({
    url: SYSTEMURL + "/queryAllUserList",
    method: "post",
    data: data,
  });
}

// 菜单权限维护 变更用户菜单信息
export function saveOrDelete(data) {
  return request({
    url: SYSTEMURL + "/saveOrDelete",
    method: "post",
    data: data,
  });
}

// 角色菜单授权 查询已获取的菜单权限
export function saveOrDeleteByRole(data) {
  return request({
    url: SYSTEMURL + "/rolePermission/saveOrDelete",
    method: "post",
    data: data,
  });
}

// 角色菜单授权 查询左侧角色
export function queryAllRoleList(data) {
  return request({
    url: SYSTEMURL + "/rolePermission/queryAllRoleList",
    method: "post",
    data: data,
  });
}

// 角色菜单授权 变更角色菜单信息
export function queryPermissionListByRole(data) {
  return request({
    url: SYSTEMURL + "/rolePermission/queryPermissionList",
    method: "post",
    data: data,
  });
}

// 获取 菜单按钮权限维护 左侧 Tree
export function selectBaSkuTypeList() {
  return request({
    url: SYSTEMURL + "/baSkuType/selectBaSkuTypeList",
    method: "post",
    data: {},
  });
}

// 点击 菜单按钮权限维护 左侧 Tree 根据点击的NODE 对应的menu_id 获取对应的权限
export function selectBaSkuTypeById(id) {
  return request({
    url: SYSTEMURL + "/baSkuType/"+id,
    method: "get"
  });
}

//  菜单按钮权限维护 新增按钮
export function insertBaSkuType(data) {
  return request({
    url: SYSTEMURL + "/baSkuType/insertBaSkuType",
    method: "post",
    data: data,
  });
}
// 菜单按钮权限维护 修改按钮
export function updateBaSkuType(data) {
  return request({
    url: SYSTEMURL + "/baSkuType/updateBaSkuType",
    method: "post",
    data: data,
  });
}
// 菜单按钮权限维护 删除按钮
export function deleteBaSkuTypeById(id) {
  return request({
    url: SYSTEMURL + "/baSkuType/deleteBaSkuTypeById/"+id,
    method: "get"
  });
}

